// @ts-nocheck
import router from '@system.router';
import prompt from '@system.prompt';
import app from '@system.app';

export default {
    count:0,
    data: {
        pageInfo: {
            scoring: '评分',
            sharing: '分享',
            views: '浏览量',
            exit: '退出',
            annualPrice: '￥99',
            productTitle: '【新品】洞洞鞋少女心蝴蝶结ins风 2022款',
            productIntroduction: '加绒洞洞鞋女冬季棉拖鞋少女心蝴蝶结ins风时尚韩版外穿厚底防滑',
            marqueeCustomData: '此商品活动中，请尽快购买！',
            shipment: '发货',
            nextDayReach: '福建泉州  |  快递:免运费',
            select: '选择',
            rewardTo: '配送至：',
            guarantee: '保障',
            guaranteeContent: '假一赔一 - 满66包邮',
            parameter: '参数',
            parameterConent: '品牌 品名…',
            goCart: '加入购物车',
            nowSell: '立即抢购',
            inventory: '库存999件',
            selectRewardTime: '选择配送时间',
            selectRewardCity: '选择配送城市',
            selectColor: '      选择颜色',
            selectSize: '       选择尺码',
            selectNumber: '购买数量',
            plus: '+',
            mins: '-',
            value:'1',
            softwareScore: '评分',
            ratingReason: '评分理由',
            confirm: '确认',
            cancel: '取消',
            ratingPlaceholder: '请输入评分理由(非必填)',
        },
        textColor: 'black',
        flagNum: 0,
        ratingReason: '',
        ratingNum: 0,
        scrollAmount: 20,
        loop: '-1',
        marqueeDir: 'right',
        interval: null,
        progress: {
            percent: 0,
            secondarypercent: 0,
        },
        swiperList: [1, 2, 3, 4, 5, 6, 7, 8],
        swiperLists: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
        newDate: JSON.stringify(new Date()).substring(1,11),
        selectAll: '鞋码 / 颜色 / 时间 / 城市',
        cityList: [['中国'], ['广东省'], ['广州市', '深圳市', '汕头市', '汕尾市', '茂名市', '揭阳市', '珠海市', '韶关市', '佛山市', '江门市']],
        selectCityList: [['中国'], ['广东省'], ['广州市']],
        selectCityString: '',
        shoesColorList: [['黑色','白色', '紫色', '粉色', '绿色']],
        selectShoesColorList: [['黑色']],
        selectShoesColorString: '',
        shoesSizeList:[ ['35码', '36码', '37码', '38码', '39码', '40码', '41码', '42码', '43码']],
        selectShoesSizeList: [['37码']],
        selectShoesSizeString: '',
        contentList: [
            {
                title: '品牌',
                content: 'C548+1'
            }, {
                title: '尺码',
                content: '36/37/38/39/40/41/42',
            }, {
                title: '图案',
                content: '卡通动漫',
            }, {
                title: '风格',
                content: '甜美',
            }, {
                title: '流行元素',
                content: '搭扣',
            }, {
                title: '后高跟',
                content: '低跟(1-3cm)',
            }, {
                title: '颜色分类',
                content: '白色/紫色/黑色/绿色/粉色',
            }, {
                title: '货号',
                content: '548+1-01#',
            }, {
                title: '上市时间',
                content: '2022年秋季',
            }, {
                title: '适合场合',
                content: '日常',
            }, {
                title: '跟底款式',
                content: '平底',
            }, {
                title: '鞋底材质',
                content: 'EVA',
            }, {
                title: '适用对象',
                content: '青年(18-40周岁)',
            }, {
                title: '鞋制作工艺',
                content: '注压鞋',
            }, {
                title: '款式',
                content: '包头鞋',
            }, {
                title: '帮面材质',
                content: 'EVA',
            }
        ]
    },
    onInit() {
    },

//
     //购物车商品
//    latestList:[],
//    addProduct(index){
//        ++this.count;
//        //商品记录到购物车中
//        this.latestList.push(this.hostList[index]);
//    },
//    showShopCart(){
//        //
//        prompt.showToast({
//           message:this.latestList
//        });
//        //鸿蒙带参数跳转页面
//        router.push({
////            uri:'pages/shopCart/shopCart',
//            params:{
//                carLists:this.latestList
//            }
//        });
//    },


    onShow() {
        this.selectCityString = this.selectCityList.join('-');
    },
    selectCity() {
        this.$element('simpledialog').show();
        prompt.showToast({
            message: '选择'
        });
    },
    selectShoes() {
        this.$element('simpledialog').show();
        prompt.showToast({
            message: '选择'
        });
    },
    selectSafeguard() {
        prompt.showToast({
            message: '保障'
        });
    },
    //    产品参数
    selectParameter(){
        this.$element('parameter').show();
        prompt.showToast({
            message:'参数'
        });
    },

    cancelSchedule() {
        this.$element('simpledialog').close();
        prompt.showToast({
            message: 'close dialog'
        });
    },
    //返回按钮
    backPage() {
//        router.back();
        router.push({
            uri: "pages/index/index"
        });
    },
    //跳转到结算页面
    buy(){
        router.push({
            uri: "pages/ordersubmit/ordersubmit",
        });
    },
    //跳转到购物车页面
    goCart(newTitle,newPrice){
        prompt.showToast({
        message: '加入购物车成功！'
    });
        var timeoutID = setTimeout(function() {
            router.push({
                uri: "pages/detail/detail",
                params:{
                    newTitle:newTitle,
                    newPrice:newPrice
                }
            });
        }, 1000);

    },

    changeDate(e) {
        this.newDate = e.year + '-' + (e.month + this.oneFlag) + '-' + e.day;
    },
    cancelDate() {
        prompt.showToast({
            message: '取消'
        });
    },
    changeCity(e) {
        this.selectCityList = e.newValue;
        this.selectCityString = e.newValue.join('-');
    },
    //    选择鞋子颜色
    changeColor(e) {
        this.selectShoesColorList = e.newValue;
        this.selectShoesColorString = e.newValue;
    },
    //    选择鞋子尺码
    changeSize(e) {
        this.selectShoesSizeList = e.newValue;
        this.selectShoesSizeString = e.newValue;
    },

    onTextClick() {
        this.$element("apiMenu").show({
            x: 380,
            y: 33
        });
    },

    addValue(index){
        ++this.pageInfo.value;
    },
    reduceValue(){
        if(this.pageInfo.value>1){
            --this.pageInfo.value
        }else{
            this.pageInfo.value = 1
        }

    },

    //    回到顶部
//
//    toTop() {
////        scroller: Scroller = new Scroller(),
////        this.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset - 100 })
//
//                this.$element("toTop").scrollTop({
//                    smooth: true
//                });
 //   },
    toTop() {
        //        function top(){
        //            this.$element("toTop").scrollTop()({
        //                smooth:true
        //            })
        //        }
    }

    }
